domU always reports an error "Ignoring shutdown request: -1" when we
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 11 Aug 2005 22:18:02 +0000 (22:18 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 11 Aug 2005 22:18:02 +0000 (22:18 +0000)
shutdown it from dom0 (using "xm shutdown" command). This patch fixes
it.

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c

index 683ddba5ed01cf5eace1e04aeccc5609a3298d1d..585c94e282a1e24613566aab4c27fadd25490a26 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/module.h>
 #include <linux/reboot.h>
 #include <linux/sysrq.h>
+#include <linux/stringify.h>
 #include <asm/irq.h>
 #include <asm/mmu_context.h>
 #include <asm-xen/evtchn.h>
@@ -254,7 +255,8 @@ static void shutdown_handler(struct xenbus_watch *watch, const char *node)
     char *str;
 
     str = (char *)xenbus_read("control", "shutdown", NULL);
-    if (IS_ERR(str))
+    /* Ignore read errors and recursive shutdown events. */
+    if (IS_ERR(str) || !strcmp(str, __stringify(SHUTDOWN_INVALID)))
         return;
 
     xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID);